﻿using System.Resources;
using System.Reflection;

namespace ServBus.ListForm2010.Resources
{
    public class DllResource
    {
        private ResourceManager _manager;

        public DllResource(string classKey)
        {
            string[] parts = classKey.Split('|');
            //Assembly asm = Assembly.Load("Servbus.ListForm2010, Version=1.0.0.0, Culture=neutral, PublicKeyToken=df5827f77359eb0a");
            Assembly asm = Assembly.GetExecutingAssembly();
            //Assembly.LoadWithPartialName("ListForm2010");
            _manager = new ResourceManager(parts[0] + "." + parts[1], asm);
        }

        public string GetString(string resouceKey)
        {
            try
            {
                return _manager.GetString(resouceKey);
            }
            catch
            {
                return resouceKey;
            }
        }
    }
}
